﻿validateUser(SAPUserStore); //validar login de usuario
//---------------------------------------------------

var formImprimir = new Ext.form.FormPanel({
    id: 'formImprimir',
    fullscreen: true,
    scroll: 'vertical',
    dockedItems: [{
        xtype: 'toolbar',
        title: 'Impresión de Reclamo',
        items: [{
            ui: 'back',
            text: 'Volver',
            iconCls: 'reply',
            iconMask: true,
            handler: function() {
                window.open("menu.html", "_self");
            }
        },
	    {
	        xtype: 'spacer'
	    },
	    {
	        xtype: 'button',
	        ui: 'confirm',
	        text: 'Imprimir',
	        iconCls: 'action',
	        iconMask: true,
	        scope: this,
	        handler: function() {
	            if (formImprimir.getValues().numeroReclamo == "") {
	                Ext.Msg.alert('', 'No ha ingresado número de reclamo a imprimir', function(res) {
	                }, this);
	            }
	            else {
	                var np = formImprimir.getValues().numeroReclamo;
	                window.open(rutaImpresion + "ImprReclamo.aspx?np=" + np, "");
	                Ext.Msg.alert('', 'Se mandó a imprimir reclamo', function(res) {
	                    window.open("menu.html", "_self");
	                }, this);
	            }
	        }
        }]
    }],
    items: [
	{
	    xtype: 'textfield',
	    useClearIcon: true,
	    name: 'numeroReclamo',
	    label: 'Número de Reclamo:',
	    placeHolder: 'Ingrese Nro. de Reclamo',
	    listeners: {
	        'render': function(thisComponent) {
	            var variable = estadoStore.last().data.Valor;
	            if (variable != 'nada' && variable != 'crearRec' && variable != 'modRec' && variable != 'verRec') {
	                thisComponent.setValue(variable);
	            }
	        }
	    }
    }],
    listeners: {
        'render': function(thisComponent) {
            if (variableFlujoStore.getCount() > 0) {
                var field = formImprimir.items.items[0];
                var doc = variableFlujoStore.last().data.Valor;
                field.setValue(doc);
            }
        }
    }
});

imprimirRecView = Ext.extend(Ext.Panel,
{
    id: 'imprimirView',
    fullscreen: true,
    layout: 'card',
    cardAnimation: 'slide',
    scroll: 'vertical',
    items: [formImprimir]
});

Ext.reg('imprimirRecView', imprimirRecView);